how to apply pythagorean theorem of triangle